package com.aspose.cells;

import java.util.Comparator;
import java.util.HashMap;

class zbnn implements Comparator {
   private boolean a;
   private HashMap b;

   zbnn(boolean var1, HashMap var2) {
      this.a = var1;
      this.b = var2;
   }

   public int compare(Object x, Object y) {
      if (x instanceof String) {
         if (y instanceof String) {
            if (this.b.size() != 0) {
               Object var3 = this.b.get(x);
               Object var4 = this.b.get(y);
               if (var3 != null && var4 != null) {
                  return this.a ? com.aspose.cells.b.a.zo.a((Integer)((Integer)var3), (Integer)((Integer)var4)) : com.aspose.cells.b.a.zo.a((Integer)((Integer)var4), (Integer)((Integer)var3));
               }

               if (var3 != null && var4 == null) {
                  return this.a ? -1 : 1;
               }

               if (var3 == null && var4 != null) {
                  return this.a ? 1 : -1;
               }

               return this.a ? ((String)x).compareTo((String)y) : ((String)y).compareTo((String)x);
            }

            return this.a ? ((String)x).compareTo((String)y) : ((String)y).compareTo((String)x);
         }

         if (y instanceof Double) {
            return this.a ? 1 : -1;
         }

         if (y instanceof Integer) {
            return this.a ? 1 : -1;
         }

         if (y instanceof DateTime) {
            return this.a ? -1 : 1;
         }

         if (y == null) {
            return this.a ? -1 : 1;
         }
      } else if (x instanceof Double) {
         if (y instanceof String) {
            return this.a ? -1 : 1;
         }

         if (y instanceof Double || y instanceof Integer) {
            if (y instanceof Double) {
               return this.a ? com.aspose.cells.b.a.zn.a((Double)x, (Double)y) : com.aspose.cells.b.a.zn.a((Double)y, (Double)x);
            } else {
               return this.a ? com.aspose.cells.b.a.zn.a((Double)x, zase.B(zase.y((Integer)y))) : com.aspose.cells.b.a.zn.a(zase.B(zase.y((Integer)y)), (Double)x);
            }
         }

         if (y instanceof DateTime) {
            return this.a ? -1 : 1;
         }

         if (y == null) {
            return this.a ? -1 : 1;
         }
      } else if (x instanceof Integer) {
         if (y instanceof String) {
            return this.a ? -1 : 1;
         }

         if (y instanceof Double) {
            return this.a ? com.aspose.cells.b.a.zn.a(zase.B(zase.y((Integer)x)), (Double)y) : com.aspose.cells.b.a.zn.a((Double)y, zase.B(zase.y((Integer)x)));
         }

         if (y instanceof Integer) {
            return this.a ? com.aspose.cells.b.a.zo.a((Integer)x, (Integer)y) : com.aspose.cells.b.a.zo.a((Integer)y, (Integer)x);
         }

         if (y instanceof DateTime) {
            return this.a ? -1 : 1;
         }

         if (y == null) {
            return this.a ? -1 : 1;
         }
      } else if (x instanceof DateTime) {
         if (y instanceof String) {
            return this.a ? 1 : -1;
         }

         if (y instanceof Double) {
            return this.a ? 1 : -1;
         }

         if (y instanceof Integer) {
            return this.a ? 1 : -1;
         }

         if (y instanceof DateTime) {
            return this.a ? ((DateTime)x).compareTo((DateTime)y) : ((DateTime)y).compareTo((DateTime)x);
         }

         if (y == null) {
            return this.a ? -1 : 1;
         }
      } else if (x == null) {
         return this.a ? 1 : -1;
      }

      return this.a ? 1 : -1;
   }
}
